package com.zpark.controller;

import com.zpark.beans.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config")
public class ConfigController {

    //自动注入
    @Autowired
    private Person person;

    @RequestMapping("/person")
    public Person getPerson(){
        return person;
    }


    //使用Vlues注解获取配置
    @Value("${server.port}")
    private  String port;

    @RequestMapping("/port")
    public String getPort(){
        return port;
    }
}
